package com.example.tongue.main;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.example.tongue.R;

public class Admin extends Activity implements View.OnClickListener {
    private EditText adminAccount,adminPassword;
    private Button adminLogIn;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.admin);
        //控件绑定id
        adminLogIn=findViewById(R.id.adminLogin);
        adminAccount=findViewById(R.id.adminAccount);
        adminPassword=findViewById(R.id.adminPassword);
        //为按钮注册点击事件
        adminLogIn.setOnClickListener(this);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.adminLogin:
            {
                String Account=adminAccount.getText().toString();
                String password=adminPassword.getText().toString();
                if( Account.equals("admin")&&password.equals("Yzb199709!")){
                    startActivity(new Intent(Admin.this,BottomNavDemo.class));
                }else {
                    Toast.makeText(Admin.this,"账号或密码错误",Toast.LENGTH_SHORT).show();
                }


            }
            break;

        }

    }
}
